<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
<meta name="keywords" content="carousel, jquery, responsive, fluid, elastic, resize, thumbnail, slider" />
<meta name="author" content="Codrops" />
<title>微评说客</title>
<link rel="stylesheet" type="text/css" href="/Public/home/style/public.css">
<link rel="stylesheet" type="text/css" href="/Public/home/style/style.css">
<link rel="stylesheet" type="text/css" href="/Public/home/style/font-awesome.css">
<link rel="stylesheet" type="text/css" href="/Public/home/style/elastislide.css">
<script src="/Public/home/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(e) {
        ki();
        $('#dimg img').each(function(){ //jquery.each()循环读取所有图片
            var height = $(this).height();
            var width = $(this).width();        
               $(this).css('width',"100%");//如果宽度超过200px,高度等比例缩放
        });
    });
	function ki(){
		$(".klk").children(".button").click(function(){
			var ji=$(this).next(".text").width();
			if(ji==0){
				$(this).next(".text").removeClass("texs2");
				$(this).next(".text").addClass("texs");
				$(this).next(".text").focus();
				$(this).val("发送");
				$(this).css({"border-top-left-radius":"0px","border-bottom-left-radius":"0px"})
				}else{
					var commetn=$(this).next(".text").val();
					addcomment(commetn);
					add(-1,commetn);
					$(this).next(".text").removeClass("texs");
					$(this).next(".text").addClass("texs2");
					$(this).next(".text").blur();
					$(this).val("回复")
					}
			})
		};
	
	function addcomment(data){
		 $.post("/home/index/addcomment",
				  {
			 		content:data,
			 		id:{$info.id},
				  },
				  function(){
				   
				  });
		
	};
	
	function add(n,data){
	  var s=document.getElementById('s');
	  var t=s.childNodes.length;
	  var li= document.createElement("li");
	  var length=document.getElementById("s").getElementsByTagName("li").length+1;
	  var now = new Date(); 
	  var nowStr = now.format("yyyy-MM-dd hh:mm:ss"); 
	  var txt="<div class='li-top'><div class='li-top-left'><a href='#'><div class='img' style='background:url({$Think.session.user.headimgurl}) top no-repeat; background-size:100%;'>   </div><div class='img2'><h4>{$Think.session.user.nickname}</h4></div></a></div><div class='li-top-right'><p>"+length+"楼</p><span>"+nowStr+"</span></div><div class='clears'></div></div><div class='conte'><p>"+data+"</p></div>";
	  li.innerHTML=txt;
	  for (var i=0;i<t;i++)
	  {
	   if (n==-1)
	   {
	    s.appendChild(li);
	   }
	   else if (i==n-1)
	   {
	    s.insertBefore(li,s.childNodes[i]);
	   }
	  }
	 };
	 
	 Date.prototype.format = function(format){ 
		 var o = { 
		 "M+" : this.getMonth()+1, //month 
		 "d+" : this.getDate(), //day 
		 "h+" : this.getHours(), //hour 
		 "m+" : this.getMinutes(), //minute 
		 "s+" : this.getSeconds(), //second 
		 "q+" : Math.floor((this.getMonth()+3)/3), //quarter 
		 "S" : this.getMilliseconds() //millisecond 
		 } 

		 if(/(y+)/.test(format)) { 
		 format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
		 } 

		 for(var k in o) { 
		 if(new RegExp("("+ k +")").test(format)) { 
		 format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); 
		 } 
		 } 
		 return format; 
		 } 

</script>
<style>
	html,body{ background:#f2f2f2;}
</style>
</head>

<body>
<header class="index-header">
	<h1>{$info.classname}</h1>
    <a href="javascript:window.history.back()" class="icon-circle-arrow-left kl"></a>
</header>

<section class="con">
	<div class="con-title">
    	<h1>{$info.title}</h1>
    	<p><strong class="cc1"><img src="/Public/home/images/right-icon2.gif" alt=""></strong><span>{$count}</span></p>
    </div>
  
    <div class="con-content">
    	<div class="con-content-top">
        	<div class="con-content-top-left">
            	<a href="#">
                    <div class="img" style="background:url({$_SESSION['user']['headimgurl']}) top no-repeat; background-size:100%;">
                        
                    </div>
                    <div class="img2">
                        <h4>{$info.author}</h4>
                       
                    </div>
                </a>
            </div>
            <div class="con-content-top-right">
            	<p>楼主</p>
                <span>{$info.addtime|date=('Y年m月d日'),###}</span>
            </div>
            <div class="clears"></div>
        </div>
        <div class="con-content2" id="dimg">
        {$info.context}
        <strong class="klk"><input type="button" value="回复" class="button"><input type="text" class="text"><div class="clears"></div></strong>
        </div>
    </div>
   
</section>
<section class="hf">
	<ul id="s">
	  <volist name="comment" id="vo">
		<li>
        	<div class="li-top">
                <div class="li-top-left">
                	<a href="#">
                        <div class="img" style="background:url({$vo.headimg}) top no-repeat; background-size:100%;">
                            
                        </div>
                        <div class="img2">
                            <h4>{$vo.author}</h4>
                        </div>
                    </a>
                </div>
                <div class="li-top-right">
                    <p>{$i}楼</p>
                    <span>{$vo.addtime|date=('Y-m-d H:i:s'),###}</span>
                </div>
                <div class="clears"></div>
            </div>
            <div class="conte">
            	<p>{$vo.value}</p>
            </div>
           
        
        </li>
		 </volist>
	</ul>
</section>
<div class="hh"></div>
<nav>
	<ul>
		<li>
        	<a href="/home/index/index.html" class="n1">
				<p></p>
				<span>首页</span>
			</a>
        </li>
		<li>
        	<a href="/home/index/questionnaire.html" class="n2">
				<p></p>
				<span>问卷</span>
			</a>
        </li>
		<li>
        	<a href="/home/index/post.html" class="n3">
				<p></p>
				<span>发布</span>
			</a>
        </li>
		<li>
        	<a href="/home/index/mine.html" class="n4">
				<p></p>
				<span>我的</span>
			</a>
        </li>
	</ul>
</nav>
</body>
</html>
